<?php
function consultar_c(){
    include(dirname(dirname(__FILE__)).'/accesobd.php');
    include (dirname(dirname(__FILE__)).'/Guardado/crearpdf2.php');
    
        $query = pg_query($conex,"SELECT c.codc, c.descargo, c.sueldo FROM cargo as c;");
        $cuerpo.= "<tr>
                        <td colspan='9' align='center'>CARGOS</td></tr><table border=1 >
      
                        <thead>  
                        <tr>
                                <th>Cod. Cargo</th>
                                <th>Descripcion</th>
                                <th>Sueldo</th>
                        </tr>
                      </thead>";?>
                          <?php
        while($cargo = pg_fetch_array($query)){
                    $cuerpo.= "
                        <tr>
                        <td> ".$cargo[0]."</td>
                        <td> ".$cargo[1]."</td>
                        <td> ".$cargo[2]." </td>
                        </tr>";
         }  
        $cuerpo.="</table>";
        crear_pdf2($cuerpo, 'cargos');
        pg_close($conex);
}
?>